/******************************************************************************* * Copyright (c) 2011, 2015 IBM Corporation and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at * http://www.eclipse.org/legal/epl-v10.html * * Contributors: * IBM Corporation - initial API and implementation * Lars Vogel <Lars.Vogel@gmail.com> - Bug 440810 ******************************************************************************/ package org.eclipse.ui.internal.handlers; import org.eclipse.core.commands.AbstractHandler; import org.eclipse.core.commands.ExecutionEvent; import org.eclipse.core.commands.ExecutionException; import org.eclipse.e4.ui.services.EContextService; import org.eclipse.ui.IWorkbenchPart; import org.eclipse.ui.handlers.HandlerUtil; public class ActiveContextInfoHandler extends AbstractHandler { @Override public Object execute(ExecutionEvent event) throws ExecutionException { final IWorkbenchPart part = HandlerUtil.getActivePartChecked(event); EContextService service = part.getSite() .getService(EContextService.class); for (String id : service.getActiveContextIds()) { System.out.println("activeContext: " + id); //$NON-NLS-1$ } return null; } }